#ifndef _GAMEMSGDEFINE_H_
#define _GAMEMSGDEFINE_H_


#include "gameDefine.h"
#include "msgType.h"




#pragma pack (1)

//////////////////////////////////////////////////////////////////////////
//@ login


struct RECV_MSG_LOGIN_MAINSERVICE : public netMsgHead
{
	RECV_MSG_LOGIN_MAINSERVICE()
	{
		size = sizeof(*this);
		type = _MSG_RECV_LOGIN_GAMESERVICE;
	}

	fint32		Stage;
};


struct SEND_MSG_LOGIN_MAINSERVICE : public netMsgHead
{
	SEND_MSG_LOGIN_MAINSERVICE()
	{
		size = sizeof(*this);
		type = _MSG_SEND_LOGIN_GAMESERVICE;
	}

	fbyte		Account[ MAX_NAME ];
	fbyte		PassWord[ MAX_NAME ];
	fint32		Guest;
 	freal32		Version;
};



struct RECV_MSG_CREATEACCOUNT : public netMsgHead
{
	RECV_MSG_CREATEACCOUNT()
	{
		size = sizeof(*this);
		type = _MSG_RECV_CREATE_ACCOUNT;
	}

	fbool		Error;
};


struct SEND_MSG_CREATEACCOUNT : public netMsgHead
{
	SEND_MSG_CREATEACCOUNT()
	{
		size = sizeof(*this);
		type = _MSG_SEND_CREATE_ACCOUNT;
	}

	fbyte		Account[ MAX_NAME ];
	fbyte		PassWord[ MAX_NAME ];
	fbyte		Name[ MAX_NAME ];
	freal32		Version;
};


struct RECV_MSG_CREATEROLE : public netMsgHead
{
	RECV_MSG_CREATEROLE()
	{
		size = sizeof(*this);
		type = _MSG_RECV_CREATE_ROLE;
	}

	fint32		Error;
};


struct SEND_MSG_CREATEROLE : public netMsgHead
{
	SEND_MSG_CREATEROLE()
	{
		size = sizeof(*this);
		type = _MSG_SEND_CREATE_ROLE;
	}

	fbyte		Name[ MAX_NAME ];

	fbyte		Role;
	fbyte		Color;
	fbyte		Eye;
	fbyte		Mouth;

	fbyte		Vitality;
	fbyte		Strength;
	fbyte		Toughness;
	fbyte		Dexterity;

	fbyte		Earth;
	fbyte		Water;
	fbyte		Fire;
	fbyte		Wind;
};


struct RECV_MSG_ROLE_INFO : public netMsgHead
{
	RECV_MSG_ROLE_INFO()
	{
		size = sizeof(*this);
		type = _MSG_RECV_ROLE_INFO;
	}

	CreatureData Data;
	fint32		Stone;

	fint32		ItemNum;
	ItemInfo	Item[ MAX_ITEM + SAET_COUNT ];
};


struct SEND_MSG_ROLE_INFO : public netMsgHead
{
	SEND_MSG_ROLE_INFO()
	{
		size = sizeof(*this);
		type = _MSG_SEND_ROLE_INFO;
	}
};

//////////////////////////////////////////////////////////////////////////
//@ chat


struct SEND_RECV_MSG_CHAT_MSG : public netMsgHead
{
	SEND_RECV_MSG_CHAT_MSG()
	{
		size = sizeof(*this);
		type = _MSG_SEND_CHAT_MSG;
	}

	fint32		Type;
	fbyte		Name[ MAX_NAME ];
	fbyte		Chat[ MAX_CHAT_MSG ];
};


//////////////////////////////////////////////////////////////////////////
//@ map


struct RECV_MSG_MAPINFO : public netMsgHead
{
	RECV_MSG_MAPINFO()
	{
		size = sizeof(*this);
		type = _MSG_RECV_MAPINFO;
	}

	fint32		Count;
	PlayerInfo	Info[ MAX_MAP_PLAYER ];
};


struct RECV_MSG_ENTERMAP : public netMsgHead
{
	RECV_MSG_ENTERMAP()
	{
		size = sizeof(*this);
		type = _MSG_RECV_ENTERMAP;
	}

	MapPos		Pos;
};


struct RECV_MSG_NPCENTERMAP : public netMsgHead
{
	RECV_MSG_NPCENTERMAP()
	{
		size = sizeof(*this);
		type = _MSG_RECV_NPCENTERMAP;
	}

	fint32		Count;
	NpcInfo		Npc[ MAX_MAP_NPC ];
};


struct RECV_MSG_PLAYERENTERMAP : public netMsgHead
{
	RECV_MSG_PLAYERENTERMAP()
	{
		size = sizeof(*this);
		type = _MSG_RECV_PLAYERENTERMAP;
	}

	PlayerInfo	Info;
	
	fint32		TeamCount;
	PlayerInfo	Team[ MAX_TEAM_CREATURE ];
};


struct RECV_MSG_EXITMAP : public netMsgHead
{
	RECV_MSG_EXITMAP()
	{
		size = sizeof(*this);
		type = _MSG_RECV_EXITMAP;
	}

	fint32		GUID;
};


struct SEND_RECV_MSG_MOVE : public netMsgHead
{
	SEND_RECV_MSG_MOVE()
	{
		size = sizeof(*this);
		type = _MSG_SEND_MOVE;
	}

	fint32		GUID;
	fint32		MapID;
	fint32		Count;
	fint32      Path[ MAX_MOVE_PATH ];
};


struct SEND_RECV_MSG_MOVE_ENTER : public netMsgHead
{
	SEND_RECV_MSG_MOVE_ENTER()
	{
		size = sizeof(*this);
		type = _MSG_SEND_MOVE_ENTER;
	}
    
    fint32      GUID;
    
    fint16	X;
	fint16	Y;
};


struct SEND_RECV_MSG_MOVE_EXIT : public netMsgHead
{
	SEND_RECV_MSG_MOVE_EXIT()
	{
		size = sizeof(*this);
		type = _MSG_SEND_MOVE_EXIT;
	}
    
    fint32      GUID;
};

//////////////////////////////////////////////////////////////////////////
// action



struct SEND_RECV_MSG_ACTION: public netMsgHead
{
	SEND_RECV_MSG_ACTION()
	{
		size = sizeof(*this);
		type = _MSG_SEND_ACTION;
	}

	fint32			GUID;
	fint32			ActionID;
};


struct SEND_RECV_MSG_DIRECTION : public netMsgHead
{
	SEND_RECV_MSG_DIRECTION()
	{
		size = sizeof(*this);
		type = _MSG_SEND_DIRECTION;
	}

	fint32		GUID;
	fint32		Direction;
};


//////////////////////////////////////////////////////////////////////////
// battle


struct MsgCreature
{
	fint16	HP;
	fint16	MAXHP;

	fubyte	Level;
	fubyte	Index;

	fbyte	Role;
	fbyte	Color;

    fbyte   RidingPet;
    fbyte   WeaponType;
    
	fint32	ActionID;
};


struct MsgPlayer 
{
	fint32		GUID;

	fint16		HP;
	fint16		MAXHP;
	fint16		MP;
	fint16		MAXMP;
};

struct SEND_MSG_BATTLE : public netMsgHead
{
	SEND_MSG_BATTLE()
	{
		size = sizeof(*this);
		type = _MSG_SEND_BATTLE;
	}

	fint32		Type;
	fint32		ID;
};

struct RECV_MSG_BATTLE : public netMsgHead
{
	RECV_MSG_BATTLE()
	{
		size = sizeof(*this);
		type = _MSG_RECV_BATTLE;
	}

	MapPos	Pos;

	fbyte	PVP;
	fbyte	Side;
	fbyte	PetNum;
	fbyte	EnemyNum;
	fbyte	EnemyPetNum;

	MsgCreature Creature[ MAX_BATTLE_ENEMY * 2 ];
};


struct SEND_MSG_BATTLE_COMMAND : public netMsgHead
{
	SEND_MSG_BATTLE_COMMAND()
	{
		size = sizeof(*this);
		type = _MSG_SEND_BATTLE_COMMAND;
	}

	CreatureFightCommand	Command;
	CreatureFightCommand    CommandPet;
};



struct RECV_MSG_BATTLE_RESULT : public netMsgHead
{
	RECV_MSG_BATTLE_RESULT()
	{
		size = sizeof(*this);
		type = _MSG_RECV_BATTLE_RESULT;
	}

	fbyte	Turn;
	fbyte	Result;
	fbyte	Num;

	fbyte	Data[ 2048 ];
};


//////////////////////////////////////////////////////////////////////////
// level up

struct SEND_MSG_LEVELUP_POINT : public netMsgHead
{
	SEND_MSG_LEVELUP_POINT()
	{
		size = sizeof(*this);
		type = _MSG_RECV_LEVELUP_POINT;
	}

	fint32 PointType;
};




//////////////////////////////////////////////////////////////////////////
// team

struct SEND_MSG_JOIN_TEAM : public netMsgHead
{
	SEND_MSG_JOIN_TEAM()
	{
		size = sizeof(*this);
		type = _MSG_SEND_JOIN_TEAM;
	}

	fint32	GUID;
};

struct RECV_MSG_JOIN_TEAM : public netMsgHead
{
	RECV_MSG_JOIN_TEAM()
	{
		size = sizeof(*this);
		type = _MSG_RECV_JOIN_TEAM;
	}

	fint32		GUID;
	MsgPlayer	Player;
};

struct RECV_MSG_SYN_TEAM : public netMsgHead
{
	RECV_MSG_SYN_TEAM()
	{
		size = sizeof(*this);
		type = _MSG_RECV_SYN_TEAM;
	}

	fint32		Count;
	MsgPlayer	Player[ MAX_TEAM_CREATURE ];
};

struct SEND_MSG_LEAVE_TEAM : public netMsgHead
{
	SEND_MSG_LEAVE_TEAM()
	{
		size = sizeof(*this);
		type = _MSG_SEND_LEAVE_TEAM;
	}

	fint32	GUID;
};


struct RECV_MSG_LEAVE_TEAM : public netMsgHead
{
	RECV_MSG_LEAVE_TEAM()
	{
		size = sizeof(*this);
		type = _MSG_RECV_LEAVE_TEAM;
	}

	fint32	GUID;

};

struct RECV_MSG_SYN_MAP_TEAM : public netMsgHead
{
	RECV_MSG_SYN_MAP_TEAM()
	{
		size = sizeof(*this);
		type = _MSG_RECV_SYN_MAP_TEAM;
	}

	fint32	Count;

	fint32	Data[ MAX_MAP_PLAYER / 2 * ( MAX_TEAM_CREATURE + 1 ) ];
};


struct RECV_MSG_NPC_MOVE : public netMsgHead
{
	RECV_MSG_NPC_MOVE()
	{
		size = sizeof(*this);
		type = _MSG_RECV_NPC_MOVE;
	}

	fint32	ID;
	fbool	Fall;

	fint16	X;
	fint16	Y;
};

//////////////////////////////////////////////////////////////////////////
// pet

struct SEND_MSG_SET_PET_TYPE : public netMsgHead
{
	SEND_MSG_SET_PET_TYPE()
	{
		size = sizeof(*this);
		type = _MSG_SEND_SET_PET_TYPE;
	}

	fint32	ID;
	fint32	PetType;
};


struct RECV_MSG_SET_PET_TYPE : public netMsgHead
{
	RECV_MSG_SET_PET_TYPE()
	{
		size = sizeof(*this);
		type = _MSG_RECV_SET_PET_TYPE;
	}

	fint32	ID;
	fint32	PetType;
};


struct SEND_MSG_SET_PET_NAME : public netMsgHead
{
	SEND_MSG_SET_PET_NAME()
	{
		size = sizeof(*this);
		type = _MSG_SEND_SET_PET_NAME;
	}

	fint32	ID;
	fbyte	Name[ MAX_NAME ];
};


struct SEND_MSG_PET_INFO : public netMsgHead
{
	SEND_MSG_PET_INFO()
	{
		size = sizeof(*this);
		type = _MSG_SEND_PET_INFO;
	}

	fint32	GUID;
};


struct RECV_MSG_PET_INFO : public netMsgHead
{
	RECV_MSG_PET_INFO()
	{
		size = sizeof(*this);
		type = _MSG_RECV_PET_INFO;
	}

	fint32			Count;
	PetSynData		Data[ MAX_TEAM_PET ];
};


//////////////////////////////////////////////////////////////////////////


struct SEND_MSG_SWITCH_ITEM : public netMsgHead
{
	SEND_MSG_SWITCH_ITEM()
	{
		size = sizeof(*this);
		type = _MSG_SEND_SWITCH_ITEM;
	}

	fint16			i1;
	fint16			i2;
};


struct SEND_MSG_SWITCH_EQUIP : public netMsgHead
{
	SEND_MSG_SWITCH_EQUIP()
	{
		size = sizeof(*this);
		type = _MSG_SEND_SWITCH_EQUIP;
	}

	fint16			i1;
	fint16			i2;
};


struct SEND_MSG_USE_ITEM : public netMsgHead
{
	SEND_MSG_USE_ITEM()
	{
		size = sizeof(*this);
		type = _MSG_SEND_USE_ITEM;
	}

	fint16	i;
	fint16	t;

	fint32	p;
};


struct RECV_MSG_USE_ITEM : public netMsgHead
{
	RECV_MSG_USE_ITEM()
	{
		size = sizeof(*this);
		type = _MSG_RECV_USE_ITEM;
	}

	BaseData Base;

};


struct SEND_MSG_DROP_EQUIP : public netMsgHead
{
	SEND_MSG_DROP_EQUIP()
	{
		size = sizeof(*this);
		type = _MSG_SEND_DROP_EQUIP;
	}

	fint16	i1;
	fint16	i2;
};





//////////////////////////////////////////////////////////////////////////


struct RECV_MSG_TALK_NPC : public netMsgHead
{
	RECV_MSG_TALK_NPC()
	{
		size = sizeof(*this);
		type = _MSG_RECV_TALK_NPC;
	}

	fint32	ID;
	fint32	Type;
	fint32	Mode;
	fbyte	Data[ MAX_NPC_DATA ];
};


struct SEND_MSG_TALK_NPC : public netMsgHead
{
	SEND_MSG_TALK_NPC()
	{
		size = sizeof(*this);
		type = _MSG_SEND_TALK_NPC;
	}

	fint32	ID;
	fint32	State;
	fint32	Select;
};




//////////////////////////////////////////////////////////////////////////


#pragma pack ()

#endif



